<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>病人治疗项目系统</title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <meta http-equiv="Access-Control-Allow-Origin" content="*"/>
    <link rel="stylesheet" type="text/css" href="/hospital/Public/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="/hospital/Public/css/layui/layui.css" media="all"/>
    <link rel="stylesheet" href="/hospital/Public/css/style.css" media="all"/>
</head>
<body>
<div class="top">
    <div class="logo">
        <img src="/hospital/Public/images/logo.png"/>
        <span>治疗系统</span>
    </div>
    <ul class="oper" lay-filter="demo">
        <li class="layui-nav-item">
            <a href="<?php echo U('Home/home/home');?>" class="<?php if(ACTION_NAME == home): ?>on<?php endif; ?>">
                <i class="fa fa-home" style="font-size: 22px;"></i>
                <span>首页</span>
            </a>
        </li>
        <li class="layui-nav-item">
            <a href="<?php echo U('Home/home/member');?>" class="<?php if(ACTION_NAME == member|ACTION_NAME == memberDetails): ?>on<?php endif; ?>">
                <i class="fa fa-folder-open"></i> <span>人员管理</span>
            </a>
        </li>
        <li class="layui-nav-item">
            <a href="<?php echo U('Home/home/items');?>" class="<?php if(ACTION_NAME == items): ?>on<?php endif; ?>">
                <i class="fa fa-folder-open"></i>
                <span>项目管理</span>
            </a>
        </li>
    </ul>
</div>
<div class="contain">
    <div class="operBox">
        <button class="layui-btn layui-btn-small layui-btn-normal c_bgblue" id="add">
            <i class="layui-icon"></i>增加
        </button>
        <button class="layui-btn layui-btn-small layui-btn-normal c_bgblue">
            <i class="layui-icon"></i> 删除
        </button>
        <div class="searchBox">
            <form action="<?php echo U('Home/Home/searchItem');?>" post="get" class="layui-form">
                <div class="layui-input-inline">
                    <input type="text" name="searchContent" placeholder="请输入搜索内容" autocomplete="off" class="layui-input">
                </div>
                <button class="layui-btn layui-btn-small"><i class="layui-icon">&#xe615;</i> 搜索</button>
            </form>

        </div>
    </div>
</div>
<div class="contain layui-form">
    <table class="layui-table">
        <colgroup>
            <col width="50"/>
            <col/>
            <col/>
            <col width="150"/>
        </colgroup>
        <thead>
        <tr>
            <th><input type="checkbox" name="" lay-skin="primary" lay-filter="allChoose"/></th>
            <th class="text_c">项目</th>
            <th class="text_c">价格</th>
            <th class="text_c">操作</th>
        </tr>
        </thead>
        <tbody>
        <?php if(is_array($items)): $i = 0; $__LIST__ = $items;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$data): $mod = ($i % 2 );++$i;?><tr>
                <td><input type="checkbox" name="" lay-skin="primary"/></td>
                <td><?php echo ($data["xname"]); ?></td>
                <td class="text_c"><?php echo ($data["xprice"]); ?></td>
                <td class="text_c">
                    <a href="javascript:;" _id="<?php echo ($data["id"]); ?>">修改</a> 
                    <a href="<?php echo U('Home/Home/deleteItem?deleteId='.$data['id']);?>" _id="<?php echo ($data["id"]); ?>" _name="delete">删除</a>
                </td>
            </tr><?php endforeach; endif; else: echo "" ;endif; ?>
        </tbody>
    </table>
</div>
<div class="layui-layer layui-layer-dialog layer-anim l_pipbox" id="layuiPip" type="dialog" contype="string"
     style="z-index: 100000;">
    <form class="layui-form" action="<?php echo U('Home/Home/addItems');?>" method="post">
        <div class="layui-layer-title">
            添加项目信息
        </div>
        <span class="layui-layer-setwin"> <a class="layui-layer-ico layui-layer-close layui-layer-close1"
                                             href="javascript:;" id="close"></a> </span>
        <div class="layui-layer-content layui-layer-padding" style="padding-top: 10px;">


            <div class="pipLeft">
                <div class="layui-inline">
                    <label class="layui-form-label">项目名称</label>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input"  required  lay-verify="required" name="itemName"/>
                    </div>
                </div>
            </div>
            <div class="pipRight">

                <div class="layui-inline">
                    <label class="layui-form-label">项目价格</label>
                    <div class="layui-input-inline">
                        <input type="text" required  lay-verify="required" class="layui-input" maxlength="11" name="itemPrice"/>
                    </div>
                </div>

            </div>
        </div>
        <div class="btnBox">
            <button class="layui-btn">保存</button>
        </div>
    </form>
</div>
<script src="/hospital/Public/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="/hospital/Public/js/jquery.js"></script>
<script>

    //初始化时间
    layui.use('laydate');
    //初始化复选框
    layui.use('form', function () {
        var $ = layui.jquery, form = layui.form();
        form.on('checkbox(allChoose)', function (data) {
            var child = $(data.elem).parents('table').find('tbody input[type="checkbox"]');
            child.each(function (index, item) {
                item.checked = data.elem.checked;
            });
            form.render('checkbox');
        });

    });

    //删除当前数据
    $('[_name="delete"]').click(function (){
     if(confirm('确定删除当前数据吗？')){
         return true;
     }else{
         return false;
     }

    })

    //点击增加案件
    $('#add').click(function () {
        $('.l_pipbox').show();
        initPip();
    });

    //点击关闭弹窗
    $('#close').click(function () {
        $('.l_pipbox').hide();
    });

    initPip();

    $(window).resize(function () {
        initPip();
    })

    //初始化弹窗位置
    function initPip() {
        var pipWid = $('.l_pipbox').outerWidth(),
            windowW = $(window).width(),
            windowH = $(window).height(),
            pipHei = $('.l_pipbox').outerHeight();
        $('.l_pipbox').css({
            'top': ( windowH - pipHei ) / 2,
            'left': ( windowW - pipWid ) / 2
        })
    }

</script>